<template>
<!-- 风控审核 -->
    <div>
      <el-container>
         <el-header style="padding: 0px;display:flex;justify-content:space-between;align-items: center">
          <div style="display: inline">
            <el-input
            placeholder="请输入合同编号"
            clearable
            style="width: 300px;margin: 0px;padding: 0px;"
            size="mini"
            :disabled="advanceSearchViewVisible"
            @keyup.enter.native="searchEmp"
            prefix-icon="el-icon-search"
            v-model="contractNo">
            </el-input>
            <el-button type="primary" size="mini" style="margin-left: 5px"
              icon="el-icon-search" @click="searchEmp" :disabled="advanceSearchViewVisible">搜索
            </el-button>
            <el-button slot="reference" type="primary" size="mini" style="margin-left: 5px"
              @click="showAdvanceSearchView">
              <i class="fa fa-lg" v-bind:class="[advanceSearchViewVisible ? faangledoubleup:faangledoubledown]"
                style="margin-right: 5px"></i>高级搜索
            </el-button>
          </div>
          <div style="margin-left: 5px;margin-right: 20px;display: inline">
          
            <el-button type="success" size="mini" :disabled="exportLoading" :loading="exportLoading" @click="exportEmps"><i class="fa fa-lg fa-level-down"
                                                                        style="margin-right: 5px"></i>导出清单
            </el-button>
          </div>
         </el-header>
        <el-main>
          <!-- 高级搜索 -->
          <transition name="slide-fade">
            <div style="margin-bottom: 10px;border: 1px;border-radius: 5px;border-style: solid;padding: 10px;box-sizing:border-box;border-color: #20a0ff"
                v-show="advanceSearchViewVisible"> 
                <el-row>
                  <el-col :span="8">
                    <span>风控审核时间:</span>  
                    <el-date-picker
                        v-model="time1"
                        type="daterange"
                        range-separator="至"
                        start-placeholder="开始日期"
                        end-placeholder="结束日期"
                        value-format="yyyy-MM-dd"
                        :picker-options="birthdayOptions"
                        style="width:70%;">
                    </el-date-picker>
                  </el-col>
                  <el-col :span="8" align="left">
                    <span>录入人：</span>
                    <el-select v-model="createdIdList" multiple  placeholder="请选择录入人">
                      <el-option
                        v-for="item in createdManArray"
                        :key="item.id"
                        :label="item.name"
                        :value="item.id">
                      </el-option>
                    </el-select>
                  </el-col> 
                  <el-col :span="8" align="left">
                    <span>合同状态：</span>
                    <el-select v-model="statusList" multiple placeholder="请选择合同状态">
                      <el-option
                        v-for="item in statusArray"
                        :key="item"
                        :label="item"
                        :value="item">
                      </el-option>
                    </el-select>
                  </el-col> 
                </el-row>
                <el-row>
                  <el-col :span="8" align="left">
                    <span>回执回销状态</span>
                    <el-select v-model="receiptSellBackStatusList" multiple placeholder="请选择回执回销状态">
                      <el-option
                        v-for="item in receiptSellBackStatusArray"
                        :key="item.value"
                        :label="item.label"
                        :value="item.value">
                      </el-option>
                    </el-select>
                  </el-col>
                  <el-col :span="8">
                    <span>产品名称:</span>
                    <el-select
                        v-model="senior.productName"
                        filterable
                        remote
                        multiple
                        :reserve-keyword="true"
                        placeholder="请输入产品名称"
                        :remote-method="inputProductNameMethod"
                        :loading="senior.inputProductNameLoading"
                        @change="productNameChange" clearable>
                        <el-option
                          v-for="item in senior.productNameArray"
                          :key="item.productId"
                          :label="item.productName+' '+item.productNo"
                          :value="item.productName"
                        >
                        </el-option>
                    </el-select>
                  </el-col> 
                </el-row>
                <el-row>
                  <el-col :span="8">
                    <span>银行到账日期：</span>
                    <el-date-picker
                        v-model="senior.bankReceivedDate"
                        type="daterange"
                        range-separator="至"
                        start-placeholder="开始日期"
                        end-placeholder="结束日期"
                        value-format="yyyy-MM-dd"
                        :picker-options="birthdayOptions"
                        style="width:60%;">
                    </el-date-picker>
                  </el-col>
                  <el-col :span="8">
                    <span>回执回销确认时间:</span>
                    <el-date-picker
                        v-model="senior.receiptSellConfirmTime"
                        type="datetimerange"
                        range-separator="至"
                        start-placeholder="开始日期"
                        end-placeholder="结束日期"
                        value-format="yyyy-MM-dd HH:mm:ss"
                        style="width:60%;">
                    </el-date-picker>
                  </el-col>
                </el-row>
                <el-row>
                  <el-col :span="8">
                    <el-button icon="el-icon-search" type="primary" size="mini" @click="search">搜索</el-button>
                    <el-button size="mini" @click="cancelSearch">取消</el-button>
                  </el-col>
                </el-row>  
            </div>
          </transition>
          <!-- 表单列表 -->
          <div>
            <el-table
              :data="table"
              v-loading="tableLoading"
              border
              stripe 
              size="mini"
              height="750"
              style="width: 100%">
              <el-table-column
                label="合同编号"
                prop="contractNo"
                align="center"
                fixed
                width="200">
              </el-table-column>
              <el-table-column
                width="180"
                align="center"
                fixed
                label="产品名称"
                prop="productName">
              </el-table-column>
               <el-table-column
                width="100"
                align="center"
                fixed
                label="资产受让人"
                prop="customerName">
              </el-table-column>
              <el-table-column
                align="center"
                prop="createdTime"
                label="录入时间"
                width="150">
              </el-table-column>
              <el-table-column
                width="85"
                align="center"
                label="录入人"
                prop="createdBy">
              </el-table-column>
              <el-table-column
                align="center"
                width="70"
                label="新老客户"
                prop="customerType">
              </el-table-column>
              <el-table-column
                width="150"
                align="center"
                label="身份证号"
                prop="idCard">
              </el-table-column>
              <!-- <el-table-column
                width="100"
                label="生日"
                align="center"
                prop="birthday">
              </el-table-column>
              <el-table-column
                label="年龄"
                align="center"
                prop="age">
              </el-table-column>
              <el-table-column
                label="性别"
                prop="sex"
                align="center">
              </el-table-column>
              <el-table-column
                width="100"
                align="center"
                label="联系电话"
                prop="telPhone">
              </el-table-column>
              <el-table-column
                width="300"
                align="center"
                label="联系地址"
                prop="address">
              </el-table-column> -->
              <el-table-column
                width="180"
                align="center"
                label="打款账号"
                prop="payBankCard">
              </el-table-column>
              <el-table-column
                width="220"
                align="center"
                label="打款银行开户行"
                prop="payOpeningBank">
              </el-table-column>
              <el-table-column
                width="180"
                align="center"
                label="收款账号"
                prop="receiveBankCard">
              </el-table-column>
              <el-table-column
                align="center"
                width="220"
                label="收款银行开户行"
                prop="receiveOpeningBank">
              </el-table-column>
              <el-table-column
                width="100"
                align="center"
                label="资产转让总额"
                prop="totalAssets">
              </el-table-column>
              <el-table-column
                align="center"
                width="100"
                label="银行到账金额"
                prop="bankEceivedAmount">
              </el-table-column>
              <el-table-column
                align="center"
                label="付款方式"
                prop="investmentType">
              </el-table-column>
              <el-table-column
                align="center"
                width="100"
                label="银行手续费"
                prop="bankFee">
              </el-table-column>
              <el-table-column
                width="85"
                align="center"
                label="预期收益率(%)"
                prop="returnRate">
              </el-table-column>
              <el-table-column
                align="center"
                width="100"
                label="银行打款日期"
                prop="payDate">
              </el-table-column>
              <el-table-column
                align="center"
                width="100"
                label="银行到账日期"
                prop="bankReceivedDate">
              </el-table-column>
              <el-table-column
                width="120"
                align="center"
                label="资产转让生效日"
                prop="assetsTransferEffDate">
              </el-table-column>
              <el-table-column
                width="95"
                align="center"
                label="服务人员"
                prop="salemanInfo.salemanName">
              </el-table-column>
              <!-- <el-table-column
                width="95"
                align="center"
                label="组"
                prop="salemanInfo.group">
              </el-table-column> 
              <el-table-column
                width="95"
                align="center"
                label="部"
                prop="salemanInfo.part">
              </el-table-column>
              <el-table-column
                width="95"
                align="center"
                label="区"
                prop="salemanInfo.area">
              </el-table-column> -->
              <el-table-column
                width="95"
                align="center"
                label="部门"
                prop="department">
              </el-table-column>
              <!-- <el-table-column
                width="120"
                align="center"
                label="预期投资退出日"
                prop="expectInvestmentExitDate">
              </el-table-column>
              <el-table-column
                width="120"
                align="center"
                label="预期退出天数"
                prop="lastInvestmentExitDate">
              </el-table-column>
              <el-table-column
                width="120"
                align="center"
                label="投资者预期收益"
                prop="expectInvestmentIncome">
              </el-table-column>
              <el-table-column
                width="120"
                align="center"
                label="预期分配总额"
                prop="expectTotalRevenue">
              </el-table-column>
              <el-table-column
                width="150"
                align="center"
                label="人民币（大写）"
                prop="expectTotalRevenueCap">
              </el-table-column>
              <el-table-column
                width="100"
                align="center"
                label="实际投资期限"
                prop="actualInvestmentExitDate">
              </el-table-column>
              <el-table-column
                width="150"
                align="center"
                label="实际投资退出日"
                prop="realInvestmentExitDate">
              </el-table-column>
              <el-table-column
                width="150"
                align="center"
                label="投资者实际收益"
                prop="realInvestmentIncome">
              </el-table-column>
              <el-table-column
                width="150"
                align="center"
                label="实际投资退出日本息总额"
                prop="realTotalRevenue">
              </el-table-column>
              <el-table-column
                width="150"
                align="center"
                label="人民币（大写）"
                prop="realTotalRevenueCap">
              </el-table-column>
              <el-table-column
                width="150"
                align="center"
                prop="expectInvestmentIncome1"
                label="预期第一期收益">
              </el-table-column>
              <el-table-column
                width="150"
                align="center"
                prop="expectInvestmentIncome2"
                label="预期第二期收益">
              </el-table-column>
              <el-table-column
                width="150"
                align="center"
                prop="expectInvestmentIncome3"
                label="预期第三期收益">
              </el-table-column>
              <el-table-column
                width="150"
                align="center"
                prop="realInvestmentIncome1"
                label="实际第一期收益">
              </el-table-column>
              <el-table-column
                width="150"
                align="center"
                prop="realInvestmentIncome2"
                label="实际第二期收益">
              </el-table-column>
              <el-table-column
                width="150"
                align="center"
                prop="realInvestmentIncome3"
                label="实际第三期收益">
              </el-table-column>
              <el-table-column
                width="150"
                align="center"
                label="财顾费总额"
                prop="totalPcFee">
              </el-table-column>
              <el-table-column
                width="150"
                align="center"
                label="第一年折标系数"
                prop="standardCoefficient">
              </el-table-column>
              <el-table-column
                width="150"
                align="center"
                label="第二年折标系数"
                prop="standardCoefficientSub">
              </el-table-column>
              <el-table-column
                width="150"
                align="center"
                label="第三年折标系数"
                prop="standardCoefficientSub3">
              </el-table-column>
              <el-table-column
                width="150"
                align="center"
                label="第一年标准业绩"
                prop="standardCoefficientFee">
              </el-table-column>
              <el-table-column
                width="150"
                align="center"
                label="第二年标准业绩"
                prop="standardCoefficientFee2">
              </el-table-column>
              <el-table-column
                width="150"
                align="center"
                label="第三年标准业绩"
                prop="standardCoefficientFee3">
              </el-table-column>
              <el-table-column
                width="100"
                align="center"
                label="第一年积分"
                prop="integral">
              </el-table-column>
              <el-table-column
                width="100"
                align="center"
                label="第二年积分"
                prop="integral2">
              </el-table-column>
              <el-table-column
                width="100"
                align="center"
                label="第三年积分"
                prop="integral3">
              </el-table-column>
              <el-table-column
                width="100"
                align="center"
                label="存续投资金额"
                prop="subsistTotalRevenue">
              </el-table-column>
              <el-table-column
                width="100"
                align="center"
                label="存续标准业绩"
                prop="subsistCoefficient">
              </el-table-column>      
              <el-table-column
                align="center"
                width="150"
                label="是否启用试算数据"
                prop="isEnableTrialData">
              </el-table-column>   -->
              <el-table-column
                align="center"
                width="150"
                label="财务审核时间"
                prop="financeCheckTime">
              </el-table-column>   
              <el-table-column
                width="150"
                align="center"
                label="风控审核时间"
                prop="riskerCheckTime">
              </el-table-column>     
              <el-table-column
                width="150"
                align="center"
                label="回执回销状态"
                prop="receiptSellBackFlagCn">
              </el-table-column>
              <el-table-column
                align="center"
                width="150"
                label="回执回销时间"
                prop="receiptSellBackTime">
              </el-table-column>
              <el-table-column
                align="center"
                width="150"
                label="回执回销确认时间"
                prop="receiptSellConfirmTime">
              </el-table-column>
              <el-table-column
                align="center"
                width="150"
                label="驳回时间"
                prop="rejectionTime"
                >
              </el-table-column>
              <el-table-column
                width="200"
                align="center"
                label="驳回理由"
                prop="remark"
                :show-overflow-tooltip="true">
              </el-table-column>
              <!-- <el-table-column
                width="150"
                align="center"
                label="确认书下载次数"
                prop="exportTimes">
              </el-table-column>
              <el-table-column
                width="150"
                align="center"
                label="确认书下载人"
                prop="exportName">
              </el-table-column> -->
              <el-table-column
                align="center"
                width="120"
                label="状态"
                fixed="right"
                prop="status">
              </el-table-column>
              <el-table-column
                fixed="right"
                align="center"
                label="操作"
                width="220">
                <template slot-scope="scope">
                  <el-button style="padding: 3px 4px 3px 4px;margin: 2px" type="warning"
                            size="mini" @click="showEditEmpView(scope.row)"
                            v-if="scope.row.status=='等待风控审核'">审核信息
                  </el-button>
                  <el-button style="padding: 3px 4px 3px 4px;margin: 2px" type="danger"
                            size="mini" @click="showEditEmpView(scope.row)" v-if="scope.row.status=='管理员驳回'">修改信息
                  </el-button>
                  <el-button style="padding: 3px 4px 3px 4px;margin: 2px" type="primary"
                            size="mini" @click="showEditEmpView(scope.row)"
                            v-if="scope.row.status!='等待风控审核' && scope.row.status!='管理员驳回'">查看信息
                  </el-button>
                  <el-button type="success" style="padding: 3px 4px 3px 4px;margin: 2px" size="mini"
                    @click="TimeEmp(scope.row)" v-if="scope.row.status=='生成确认书' ||scope.row.status=='管理员驳回' ">确认实际退出日
                  </el-button>
                  <el-button type="success" style="padding: 3px 4px 3px 4px;margin: 2px" size="mini"
                     v-if="scope.row.status=='生成确认书'"
                     @click="exportContract(scope.row)">生成合同确认书
                  </el-button>
                  <el-button type="danger" v-if="!common.isNull(scope.row.receiptSellBackTime) && (scope.row.status != '合同作废')" 
                   style="padding: 3px 4px 3px 4px;margin: 2px" size="mini"
                   :disabled="scope.row.receiptSellBackFlag" @click="sureReceiptSellBack(scope.row)">回执回销确认
                  </el-button>
                  <el-button type="danger" v-if="scope.row.status!='合同作废'"
                   style="padding: 3px 4px 3px 4px;margin: 2px" size="mini"
                   @click="sureRiskerDelete(scope.row)">作废
                  </el-button>
                </template>
              </el-table-column>
            </el-table>
            <el-pagination
                background
                :page-size="pageSize"
                :current-page="currentPage"
                @current-change="currentChange"
                layout="prev, pager, next"
                :total="totalCount"
                style="margin:50px;">
            </el-pagination>
            <div style="margin:30px 0;" class="fw">共{{Math.ceil(totalCount/pageSize)}}页,{{totalCount}}条信息</div>
          </div>
        </el-main>
        <!-- 审核信息 -->
        <template>
          <el-dialog title="风控审核" :visible.sync="dialogFormVisible" 
            v-loading="dialogLoading"
            :close-on-click-modal="false"
            width="80%"
            >
            <el-form :model="form"  ref="form" :disabled="form.disabled">
              <el-row>
                <el-col :span="8">
                  <el-form-item label="合同编号:">
                      {{form.contractNo}}
                  </el-form-item>
                </el-col>
                <el-col :span="8">
                  <el-form-item label="产品名称:" >
                    {{form.productName}}
                  </el-form-item>
                </el-col>
                <el-col :span="8">
                    <el-form-item label="最迟投资退出天数:">
                       {{form.lastInvestmentExitDate}}
                    </el-form-item>
                </el-col>
              </el-row>
              <el-row>
                <el-col :span="8">
                  <el-form-item label="资产受让人:">
                      {{form.customerName}}
                  </el-form-item>
                </el-col>
                <el-col :span="8">
                  <el-form-item label="身份证号:">
                      {{form.idCard}}
                  </el-form-item>
                </el-col>
                <el-col :span="8">
                  <el-form-item label="新老客户:">
                      {{form.customerType}}
                  </el-form-item>
                </el-col>
              </el-row>
              <el-row>
                <el-col :span="8">
                  <el-form-item label="打款账号:">
                      {{form.payBankCard}}
                  </el-form-item>
                </el-col>
                <el-col :span="8">
                  <el-form-item label="收款账号:">
                      {{form.receiveBankCard}}
                  </el-form-item>
                </el-col>
              </el-row>
              <el-row>
                <el-col :span="8">
                  <el-form-item label="打款账户开户行:">
                      {{form.payOpeningBank}}
                  </el-form-item>
                </el-col>
                <el-col :span="8">
                  <el-form-item label="收款账号开户行:">
                      {{form.receiveOpeningBank}}
                  </el-form-item>
                </el-col>
              </el-row>
              <el-row>
                <el-col :span="8">
                  <el-form-item label="联系电话:">
                      {{form.telPhone}}
                  </el-form-item>
                </el-col>
                <el-col :span="8">
                  <el-form-item label="联系地址:">
                      {{form.address}}
                  </el-form-item>
                </el-col>
                <el-col :span="1"></el-col>
                <el-col :span="7" align="right">
                  <el-form-item label="部门:">
                      {{form.department}}
                  </el-form-item>
                </el-col>
              </el-row>
              <el-row>
                <el-col :span="8">
                  <el-form-item label="付款方式:" prop="investmentType">
                      {{form.investmentType}}
                  </el-form-item>
                </el-col>
                <el-col :span="8">
                  <el-form-item label="资产转让总额:"  prop='totalAssets'>
                      {{form.totalAssets}}
                  </el-form-item>
                </el-col>
                <el-col :span="8">
                  <el-form-item label="打款日期:">
                      {{form.payDate}}
                  </el-form-item>
                </el-col>
              </el-row>
              <el-row>
                <el-col :span="8">
                  <el-form-item label="服务人员:" prop="salemanName">
                      {{form.salemanName}}
                  </el-form-item>
                </el-col>
                <el-col :span="8">
                    <el-form-item label="到账金额:">
                        {{form.bankEceivedAmount}}
                    </el-form-item>
                </el-col>
                <el-col :span="8">
                    <el-form-item label="到账日期:">
                        {{form.bankReceivedDate}}
                    </el-form-item>
                </el-col>
              </el-row>
              <el-row>
                <el-col :span="8">
                  <el-form-item label="预期收益率:">
                    {{form.totalAssetsReturn}}
                  </el-form-item>
                </el-col>
                <el-col :span="8">
                    <el-form-item label="手续费:">
                        {{form.bankFee}}
                    </el-form-item>
                </el-col>
                <el-col :span="8">
                    <el-form-item label="资产转让生效日:">
                       <el-date-picker
                        v-model="form.assetsTransferEffDate"
                        type="date"
                        placeholder="请选择"
                        value-format="yyyy-MM-dd"
                        @change="assetsTransferEffDateChange">
                        </el-date-picker>
                    </el-form-item>
                </el-col>
              </el-row>
              <el-row>
                <!-- <el-col :span="12">
                  <el-form-item label="回执回销状态:">
                      {{form.receiptSellBackFlagCn}}
                  </el-form-item>
                </el-col>
                <el-col :span="12">
                  <el-form-item label="回执回销确认时间:">
                      {{form.receiptSellConfirmTime}}
                  </el-form-item>
                </el-col> -->
                <el-col :span="12">
                    <el-form-item label="驳回原因:">
                        <el-input type="text" auto-complete="off" placeholder="如需驳回，请输入原因" 
                            clearable v-model="form.remark">
                        </el-input>
                    </el-form-item>
                </el-col>
              </el-row>
              <el-row>
                  <el-col :span="15"></el-col>
                  <el-col :span="8" style="text-align:right;">
                      <el-button type="primary" @click="sureAdd">通过</el-button>
                      <el-button type="danger" @click="cancelAdd">驳回</el-button>
                  </el-col>
                  <el-col :span="1"></el-col>
              </el-row>
            </el-form>
          </el-dialog>
        </template>
        <!--实际投资退出日 -->
        <el-dialog title="设置实际投资退出日" :visible.sync="realInvestmentExitDateShow"
        :close-on-click-modal="false" width="700px" v-loading="compute.loading">
            <el-row>
                <el-col :span="4"></el-col>
                <el-col :span="16">
                    <span>实际投资退出日:</span>
                    <el-date-picker
                        v-model="compute.realInvestmentExitDate"
                        type="date"
                        placeholder="选择实际投资退出日"
                        value-format="yyyy-MM-dd" @change="realInvestmentExitDateChange">
                    </el-date-picker>
                </el-col>
                <el-col :span="4">
                    
                </el-col>
            </el-row>
            <el-row>
                <el-col :span="10">
                    实际投资期限:{{compute.actualInvestmentExitDate}}
                </el-col>
                <el-col :span="14">
                    投资者实际收益:{{compute.realInvestmentIncome}}
                </el-col> 
            </el-row>
            <el-row>
                <el-col :span="10">
                    实际投资退出日本息总额:{{compute.realTotalRevenue}}
                </el-col>
                <el-col :span="14">
                    人民币（大写）:{{compute.realTotalRevenueCap}}
                </el-col>
            </el-row>
            <el-row>
                <el-col :span="10">
                    实际第一期收益:{{compute.realInvestmentIncome1}}
                </el-col> 
                <el-col :span="14">
                    实际第二期收益:{{compute.realInvestmentIncome2}}
                </el-col> 
            </el-row>
            <el-row>
                <el-col :span="8"></el-col>
                <el-col :span="10"></el-col>
                <el-col :span="6">
                    <el-button type="primary" @click="sureRealInvestmentExitDate">确认</el-button>
                    <el-button @click="realInvestmentExitDateShow=false">取消</el-button>
                </el-col>
            </el-row>
        </el-dialog>
      </el-container>
    </div>
</template>
<script>
var productId = "";
var productIdList=[];
var salemanId = "";
var contractId = -1;
var startBankReceivedDate="";
var endBankReceivedDate="";
var startReceiptSellConfirmTime="";
var endReceiptSellConfirmTime="";
var searchInfo={
  contractNo:"",
  createdId:"",
  createdIdList:[],
  status:"",
  statusList:[],
  startRiskerCheckTime:"",
  endRiskerCheckTime:"",
  receiptSellBackStatus:"",
  receiptSellBackStatusList:[],
  productId:"",
  productIdList:[],
  startBankReceivedDate:"",
  endBankReceivedDate:"",
  startReceiptSellConfirmTime:"",
  endReceiptSellConfirmTime:"",
}
export default {
  data() {
    return {
      exportLoading:false,
      contractNo: "",
      createdId:"",
      createdIdList:[],
      createdManArray:[],
      status:"",
      statusList:[],
      statusArray:[],
      receiptSellBackStatus:"",
      receiptSellBackStatusList:[],
      receiptSellBackStatusArray:[
        {
          label:"回执已回销",
          value:"1"
        },
        {
          label:"待风控确认回执回销",
          value:"2"
        },
        {
          label:"未录入回销时间",
          value:"3"
        },
      ],
      senior:{
        productName:[],
        productNameArray:[],
        bankReceivedDate:'',
        receiptSellConfirmTime:"",
        inputProductNameLoading:false,
      },
      saleman: "",
      advanceSearchViewVisible: false,
      faangledoubleup: "fa-angle-double-up",
      faangledoubledown: "fa-angle-double-down",
      time1: [],
      dialogFormVisible: false,
      inputsalemanNameLoading: false,
      dialogLoading: false,
      inputsalemanNameArray: [],
      realInvestmentExitDateShow:false,
      birthdayOptions: {
        disabledDate(time) {
          return time.getTime() > Date.now();
        }
      },
      form: {
        contractNo: "",
        productName: "",
        standardCoefficient: 0,
        customerName: "",
        idCard: "",
        sex: "男",
        birthday: "",
        age: "",
        payBankCard: "",
        receiveBankCard: "",
        payOpeningBank: "",
        receiveOpeningBank: "",
        telPhone: "",
        address: "",
        totalAssets: "",
        totalAssetsReturn: 0,
        investmentType: "",
        salemanName: "",
        disabled: false,
        bankEceivedAmount: "",
        bankFee: "",
        bankReceivedDate: "",
        remark: "",
        assetsTransferEffDate: "",
        effectiveDateFormula:1,
        expectInvestmentExitDate: "",
        lastInvestmentExitDate: 0
      },
      compute:{
          loading:false,
          realInvestmentExitDate:"",
          actualInvestmentExitDate:"",
          realInvestmentIncome:"",
          realTotalRevenue:"",
          realTotalRevenueCap:"",
          realInvestmentIncome1:"",
          realInvestmentIncome2:"",
      },
      table: [],
      tableLoading: false,
      currentPage: 1,
      pageSize: 20,
      totalCount: 0,
      tableSearchModel: "common",
      receiptSellBackTimeShow: false,
      receiptSellBackTime: "",
      surereceiptSellBackTimeLoading: false
    };
  },
  mounted: function() {
    this.getRequest("/common/getStatusList").then(
      resp => {
        if (resp && resp.data.status == 200) {
          this.statusArray=resp.data.obj
        }
      }
    );
    this.getRequest("/common/getAllUser").then(
      resp => {
        if (resp && resp.data.status == 200) {
          this.createdManArray=resp.data.obj
        }
      }
    );
    this.initData();
  },
  methods: {
    initData: function() {
      this.requestTableInfo(
        this.tableSearchModel,
        this.currentPage,
        this.pageSize
      );
    },
    // 请求列表数据
    requestTableInfo: function(model, pageCount, pageSize) {
      var that = this;
      //根据合同编号搜查的普通模式
      if (model == "common") {
        that.tableLoading = true;
        that
          .postRequest("/risker/queryContract", {
            contractNo: that.contractNo,
            pageIndex: pageCount,
            pageSize: pageSize
          })
          .then(resp => {
            that.tableLoading = false;
            if (resp && resp.data.status == 200) {
              that.table = resp.data.obj.rows;
              that.totalCount = resp.data.obj.total;
              searchInfo={
                contractNo:that.contractNo,
                createdId:"",
                createdIdList:[],
                status:"",
                statusList:[],
                startRiskerCheckTime:"",
                endRiskerCheckTime:"",
                receiptSellBackStatus:"",
                receiptSellBackStatusList:[],
                startBankReceivedDate:"",
                endBankReceivedDate:"",
                startReceiptSellConfirmTime:"",
                endReceiptSellConfirmTime:"",
                productId:"",
                productIdList:[],
              }
            }
          });
      } else if (model == "senior") {
        //高级搜索模式
        this.time1 = this.time1 || [];
        this.time1[0] = this.time1[0] || "";
        this.time1[1] = this.time1[1] || "";
        if(this.senior.bankReceivedDate){
            startBankReceivedDate=this.senior.bankReceivedDate[0];
            endBankReceivedDate=this.senior.bankReceivedDate[1];
        }else{
            startBankReceivedDate="";
            endBankReceivedDate="";
        }
        if(this.senior.receiptSellConfirmTime){
          startReceiptSellConfirmTime=this.senior.receiptSellConfirmTime[0];
          endReceiptSellConfirmTime=this.senior.receiptSellConfirmTime[1];
        }else{
          startReceiptSellConfirmTime="";
          endReceiptSellConfirmTime="";
        }
        that.tableLoading = true;
        that
          .postRequest("/risker/queryContract", {
            startRiskerCheckTime: this.time1[0],
            endRiskerCheckTime: this.time1[1],
            createdIdList:this.createdIdList,
            statusList:this.statusList,
            receiptSellBackStatusList:this.receiptSellBackStatusList,
            productIdList:productIdList,
            startBankReceivedDate:startBankReceivedDate,
            endBankReceivedDate:endBankReceivedDate,
            startReceiptSellConfirmTime:startReceiptSellConfirmTime,
            endReceiptSellConfirmTime:endReceiptSellConfirmTime,
            pageIndex: pageCount,
            pageSize: pageSize
          })
          .then(resp => {
            console.log(resp)
            that.tableLoading = false;
            if (resp && resp.data.status == 200) {
              that.table = resp.data.obj.rows;
              that.totalCount = resp.data.obj.total;
              searchInfo={
                contractNo:"",
                startRiskerCheckTime:this.time1[0],
                endRiskerCheckTime:this.time1[1],
                createdId:this.createdId,
                createdIdList:this.createdIdList,
                status:this.status,
                statusList:this.statusList,
                receiptSellBackStatus:this.receiptSellBackStatus,
                receiptSellBackStatusList:this.receiptSellBackStatusList,
                productId:productId,
                productIdList:productIdList,
                startBankReceivedDate:startBankReceivedDate,
                endBankReceivedDate:endBankReceivedDate,
                startReceiptSellConfirmTime:startReceiptSellConfirmTime,
                endReceiptSellConfirmTime:endReceiptSellConfirmTime,
              }
            }
          });
      }
    },
    //列表当前页改变
    currentChange: function(currentChange) {
      this.currentPage = currentChange;
      this.requestTableInfo(
        this.tableSearchModel,
        this.currentPage,
        this.pageSize
      );
    },
    //查看列表信息
    showEditEmpView: function(item) {
      console.log(item);
      this.dialogFormVisible = true;
      this.form = item;
      if (item.status == "等待风控审核" || item.status=="管理员驳回") {
        this.form.disabled = false;
      } else {
        this.form.disabled = true;
      }
      this.form.totalAssetsReturn = item.returnRate;
      this.form.salemanName = item.salemanInfo.salemanName;
      contractId = item.contractId;
      //资产转让生效日默认值为银行到账日后N天()
      if(item.assetsTransferEffDate==null){
        this.form.assetsTransferEffDate=this.getNewDay(this.form.bankReceivedDate,this.form.effectiveDateFormula)
        this.assetsTransferEffDateChange(this.form.assetsTransferEffDate)
      }
    },
    getNewDay(dateTemp, days) {
      var dateTemp = dateTemp.split("-");
      var nDate = new Date(dateTemp[1] + '-' + dateTemp[2] + '-' + dateTemp[0]); //转换为MM-DD-YYYY格式  
      var millSeconds = Math.abs(nDate) + (days * 24 * 60 * 60 * 1000);
      var rDate = new Date(millSeconds);
      var year = rDate.getFullYear();
      var month = rDate.getMonth() + 1;
      if (month < 10) month = "0" + month;
      var date = rDate.getDate();
      if (date < 10) date = "0" + date;
      return (year + "-" + month + "-" + date);
    },
    // 点击高级搜索
    showAdvanceSearchView() {
      this.advanceSearchViewVisible = !this.advanceSearchViewVisible;
      this.contractNo = "";
      if (this.tableSearchModel == "common") {
        this.tableSearchModel = "senior";
      } else if (this.tableSearchModel == "senior") {
        this.tableSearchModel = "common";
      }
    },
    //取消高级搜索
    cancelSearch: function() {
      this.advanceSearchViewVisible = false;
      this.tableSearchModel = "common";
    },
    // 普通搜索
    searchEmp: function() {
      this.currentPage = 1;
      this.requestTableInfo(
        this.tableSearchModel,
        this.currentPage,
        this.pageSize
      );
    },
    //高级搜索
    search: function() {
      this.currentPage = 1;
      this.requestTableInfo(
        this.tableSearchModel,
        this.currentPage,
        this.pageSize
      );
    },
    // 导出清单
    exportEmps: function() {
      this.exportLoading = true; 
      var address=`/risker/risker_export_contract?contractNo=${searchInfo.contractNo}&&startRiskerCheckTime=${searchInfo.startRiskerCheckTime}&&endRiskerCheckTime=${searchInfo.endRiskerCheckTime}&&statusList=${searchInfo.statusList}&&createdIdList=${searchInfo.createdIdList}&&receiptSellBackStatusList=${searchInfo.receiptSellBackStatusList}&&productIdList=${searchInfo.productIdList}&&startBankReceivedDate=${searchInfo.startBankReceivedDate}&&endBankReceivedDate=${searchInfo.endBankReceivedDate}&&startReceiptSellConfirmTime=${searchInfo.startReceiptSellConfirmTime}&&endReceiptSellConfirmTime=${searchInfo.endReceiptSellConfirmTime}`; 
      // this.common.downloadFile(address); 
      this.common.downloadFile(address);
      setTimeout(() => {
        this.exportLoading =false;
      }, 2000);
    },

    // 输入服务人员
    inputsalemanNameMethod: function(query) {
      if (query !== "") {
        this.inputsalemanNameLoading = true;
        this.getRequest("/auditor/matchingSaleman?salemanName=" + query).then(
          resp => {
            if (resp && resp.data.status == 200) {
              this.inputsalemanNameArray = resp.data.obj;
            }
            this.inputsalemanNameLoading = false;
          }
        );
      } else {
        this.inputsalemanNameArray = [];
      }
    },
    // 服务人员发生变化
    salemanNameChange: function(e) {
      var that = this;
      if (e == "") {
        salemanId = "";
      } else {
        this.getRequest("/auditor/matchingSaleman?salemanName=" + e).then(
          resp => {
            if (resp && resp.data.status == 200) {
              salemanId = resp.data.obj[0].salemanId;
            }
          }
        );
      }
    },
    // 输入产品名称
    inputProductNameMethod(query){
      if (query !== "") {
        this.senior.inputProductNameLoading = true;
        this.postRequest("/common/get_product_info",{
          searchContent:query
        }).then(
          resp => {
            if (resp && resp.data.status == 200) {
              this.senior.productNameArray = resp.data.obj;
            }
            this.senior.inputProductNameLoading = false;
          }
        );
      } else {
        this.senior.productNameArray = [];
      }
    },
    // 产品名称发生变化
    productNameChange(e){
      console.log(e)
      var that = this;
      if (e == "") {
        productId = "";
        productIdList=[];
      } else {
        that.dialogLoading = true;
        productIdList=[];
        for(let i=0;i<e.length;i++){  
          this.postRequest("/common/get_product_info",{
            searchContent:e[i]
          }).then(
          resp => { 
            if (resp && resp.data.status == 200) {
              productId = resp.data.obj[0].productId;
              productIdList.push(resp.data.obj[0].productId)
            }
          }
        );
        }
        that.dialogLoading = false;
        
        
        console.log(productIdList)
      }
    },
    //资产转让生效日改变
    assetsTransferEffDateChange(data) {
      if (data == null) {
        data = "";
      } else {
        if(this.form.lastInvestmentExitDate!=null){
          this.getRequest(
          "/risker/trialExpectDate?assetsTransferEffDate=" +
            data +
            "&lastInvestmentExitDate=" +
            this.form.lastInvestmentExitDate
          ).then(resp => {
            if(resp && resp.data.status==200){
                this.form.expectInvestmentExitDate=resp.data.msg
            }
          });
        }
      }
    },
    //通过
    sureAdd: function() {
      var that = this;
      if (
        this.common.isNull(this.form.assetsTransferEffDate) ||
        this.form.assetsTransferEffDate == null
      ) {
        this.common.showToast("info", "请选择资产转让生效日");
      }  else {
        this.dialogLoading = true;
        this.putRequest("/risker/verify", {
          contractId: contractId,
          assetsTransferEffDate	:this.form.assetsTransferEffDate,
        }).then(resp => {
          that.dialogLoading = false;
          if (resp && resp.data.status == 200) {
            that.dialogFormVisible = false;
            that.common.showToast("success", resp.data.msg);
            this.initData();
          }
        });
      }
    },
    // 驳回
    cancelAdd: function() {
      var that = this;
      if (this.common.isNull(this.form.remark) || this.form.remark == null) {
        this.common.showToast("info", "请输入驳回理由");
      } else {
        this.dialogLoading = true;
        this.putRequest("/risker/reject", {
          contractId: contractId,
          remark: this.form.remark
        }).then(resp => {
          that.dialogLoading = false;
          if (resp && resp.data.status == 200) {
            that.dialogFormVisible = false;
            that.common.showToast("success", resp.data.msg);
            this.initData();
          }
        });
      }
    },
    // 点击确认实际退出日
    TimeEmp(item){
        this.compute.realInvestmentExitDate=""
        this.compute.actualInvestmentExitDate=""
        this.compute.realInvestmentIncome=""
        this.compute.realTotalRevenue=""
        this.compute.realTotalRevenueCap=""
        this.compute.realInvestmentIncome1=""
        this.compute.realInvestmentIncome2=""
        contractId=item.contractId;
        this.realInvestmentExitDateShow=true;
    },
    //导出合同确认书
    exportContract(item){
      var address="/risker/export_contract?contractId="+item.contractId; 
      this.common.downloadFile(address)
      
      // var address="/maitian-server/risker/export_contract?contractId="+item.contractId;
      // this.common.downloadFile(address); 
    },
    //实际退出日期改变
    realInvestmentExitDateChange(data){
        var that=this;
        if(data==null){
            that.compute.actualInvestmentExitDate=""
            that.compute.realInvestmentIncome=""
            that.compute.realTotalRevenue=""
            that.compute.realTotalRevenueCap=""
            that.compute.realInvestmentIncome1=""
            that.compute.realInvestmentIncome2=""
        }else{
            this.compute.loading=true;
            this.getRequest("/risker/trialRealInvestmentDate?contractId="+contractId+
            "&realInvestmentExitDate="+this.compute.realInvestmentExitDate).then(resp =>{
                that.compute.loading=false;
                if(resp &&resp.data.status==200){
                    that.compute.actualInvestmentExitDate=resp.data.obj.actualInvestmentExitDate
                    that.compute.realInvestmentIncome=resp.data.obj.realInvestmentIncome
                    that.compute.realTotalRevenue=resp.data.obj.realTotalRevenue
                    that.compute.realTotalRevenueCap=resp.data.obj.realTotalRevenueCap
                    that.compute.realInvestmentIncome1=resp.data.obj.realInvestmentIncome1
                    that.compute.realInvestmentIncome2=resp.data.obj.realInvestmentIncome2
                }
            })
        }
    },
    // 确认实际退出日
    sureRealInvestmentExitDate(){
        if(this.common.isNull(this.compute.realInvestmentExitDate) ||this.compute.realInvestmentExitDate==null){
            this.common.showToast('info','请选择实际投资退出日')
        }else{
            this.compute.loading=true;
            this.putRequest("/risker/confirmRealInvestmentExitDate",{
                contractId:contractId,
                realInvestmentExitDate:this.compute.realInvestmentExitDate,
            }).then(resp =>{
                this.compute.loading=false;
                if(resp &&resp.data.status==200){
                    this.common.showToast('success',resp.data.msg)
                    this.realInvestmentExitDateShow=false;
                    this.initData()
                }
            })
        }
    },
    //确认回执回销
    sureReceiptSellBack(item){
      console.log(item.receiptSellBackTime)
      this.$confirm('回执回销时间:'+item.receiptSellBackTime, '确认'+item.contractNo, {
          confirmButtonText: '确定',
          cancelButtonText: '取消',
          type: 'warning'
        }).then(() => {
          this.getRequest('/risker/receipt_verify?contractId='+item.contractId).then(resp=>{
            if(resp && resp.data.status==200){
              this.common.showToast('success','确认成功')
              this.initData()
            }
          })
          
        }).catch(() => {
                   
        });
    },
    // 确认作废
    sureRiskerDelete(item){
      this.$confirm('确认作废该合同吗？', {
          confirmButtonText: '确定',
          cancelButtonText: '取消',
          type: 'warning'
        }).then(() => {
          this.putRequest("/risker/risker_delete", {
            contractId: item.contractId,
          }).then(resp => {
            if (resp && resp.data.status == 200) {
              this.common.showToast('success',"合同编号："+item.contractNo+"，作废成功！");
              this.initData();
            }
          });
          // this.getRequest('/risker/receipt_verify?contractId='+item.contractId).then(resp=>{
          //   if(resp && resp.data.status==200){
          //     this.common.showToast('success','确认成功')
          //     this.initData()
          //   }
          // })
          
        }).catch(() => { 
      });
    }
  }
};
</script>
<style scoped>
.el-row {
  margin-top: 10px;
}
.el-col {
  min-height: 50px;
  line-height: 50px;
  text-align: left;
}
.el-input {
  width: 50%;
}
.el-dialog__body {
  padding-top: 0px;
  padding-bottom: 0px;
}

.slide-fade-enter-active {
  transition: all 0.8s ease;
}

.slide-fade-leave-active {
  transition: all 0.8s cubic-bezier(1, 0.5, 0.8, 1);
}

.slide-fade-enter,
.slide-fade-leave-to {
  transform: translateX(10px);
  opacity: 0;
}
.idcard {
  border-bottom: 1px solid #ccc;
}
</style>
